//
//  ByUIMineWelfareOneVC.m
//  chequanbao_ios
//
//  Created by mc on 2017/6/13.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByUIMineWelfareOneVC.h"

@interface ByUIMineWelfareOneVC ()
@property (nonatomic, strong) UIScrollView *scroll;
@end

@implementation ByUIMineWelfareOneVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的福利";
    [self addLeftBackBarButtonItem];
    [self createView];
}

#pragma mark -- getter
- (UIScrollView *)scroll {
    
    if (!_scroll) {
        _scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64)];
        _scroll.showsVerticalScrollIndicator = NO;
        _scroll.bounces = NO;
        [self.view addSubview:_scroll];
    }
    return _scroll;
}


#pragma mark -- 创建视图
- (void)createView{
    CGFloat x, y, width, height;
    CGFloat margin_h = 25, margin_v = 15;
    
    NSArray *images = @[@"mine_fuli11",@"mine_fuli12",@"mine_fuli13",@"mine_fuli14",@"mine_fuli15"];
    for (int i = 0; i < images.count; i ++) {
        
        width = SCREEN_WIDTH - margin_h * 2;
        height = width / 3.6;
        x = margin_h;
        y = (margin_v + height) * i + 20;
        
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, width, height)];
        imageView.userInteractionEnabled = YES;
        imageView.image = [UIImage imageNamed:images[i]];
        [self.scroll addSubview:imageView];
        imageView.layer.cornerRadius = 5;
        imageView.layer.masksToBounds = YES;
        imageView.tag = i;
        
    }
    UIImageView *lastImg = [self.scroll viewWithTag:images.count - 1];
    self.scroll.contentSize = CGSizeMake(0, lastImg.bottom + 20);


}


@end
